﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sistem
{
    public partial class AdministratorForma : Form
    {
        private Korisnik user;

        public AdministratorForma()
        {
            InitializeComponent();
        }

        public AdministratorForma(Korisnik user)
        {
            InitializeComponent();
            this.user = user;
            this.korisnikKontrola1.postaviUser(user.Username);
            this.korisnikKontrola1.postaviKorisnickiTip("Administrator");
            this.korisnikKontrola1.spremiKontrole(this.button1, this.button2, this.button3, this.button4);
            this.korisnikKontrola1.ucitajFlow(this.flowPretraga);
            this.korisnikKontrola1.postaviEvent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (button1.Text[0] == '+')
            {
                button1.Text = '-' + button1.Text.Remove(0, 1);
                panel1.Size = new Size(1200, 300);
            }
            else
            {
                button1.Text = '+' + button1.Text.Remove(0, 1);
                panel1.Size = new Size(1200, 0);
            }   
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (button2.Text[0] == '+')
            {
                button2.Text = '-' + button2.Text.Remove(0, 1);
                panel2.Size = new Size(1200, 300);
            }
            else
            {
                button2.Text = '+' + button2.Text.Remove(0, 1);
                panel2.Size = new Size(1200, 0);
            }   
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (button3.Text[0] == '+')
            {
                button3.Text = '-' + button3.Text.Remove(0, 1);
                panel3.Size = new Size(1200, 300);
            }
            else
            {
                button3.Text = '+' + button3.Text.Remove(0, 1);
                panel3.Size = new Size(1200, 0);
            }   
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (button4.Text[0] == '+')
            {
                button4.Text = '-' + button4.Text.Remove(0, 1);
                panel4.Size = new Size(1200, 300);
            }
            else
            {
                button4.Text = '+' + button4.Text.Remove(0, 1);
                panel4.Size = new Size(1200, 0);
            }    
        }

        private void AdministratorForma_Load(object sender, EventArgs e)
        {
            panel1.Controls.Add(new AdministratorKorisniciKontrola());
            panel2.Controls.Add(new AdministratorPredmetiKontrola());
            panel3.Controls.Add(new AdministratorKabinetiKontrola());
            panel4.Controls.Add(new AdministratorSkolskeGodineKontrola());
        }
    }
}
